# -*- coding: utf-8 -*-

from ip.opdef import TranOp, TranOpCode
from .package import NanoOpTypes


HANA_TOPS = {
    'ld': [TranOp, ['op_code', TranOpCode.LD], NanoOpTypes.TopsName, None,
           [['pid', 'dst_peer_id'],
            ['dst', 'dst_addr'],
            ['sb_addr', 'dst_sb_addr', -1],
            ['ain_addr', 'dst_ain_addr', -1],

            ['src', 'src_addr']],
           [['len_limit', 1],
            ['dst_stride', 1],
            ['dst_clear', False],
            ['src_stride', 1]]],
    'ld_v': [TranOp, ['op_code', TranOpCode.LD], NanoOpTypes.TopsName, None,
           [['pid', 'dst_peer_id'],
            ['dst', 'dst_addr'],
            ['sb_addr', 'dst_sb_addr', -1],
            ['ain_addr', 'dst_ain_addr', -1],
            ['dst_stride', 'dst_stride', 1],
            ['count', 'len_limit'],

            ['src', 'src_addr'],
            ['src_stride', 'src_stride', 1]],
           [['dst_clear', False]]],
    'clr': [TranOp, ['op_code', TranOpCode.CLR], NanoOpTypes.TopsName, None,
            [['pid', 'dst_peer_id'],
             ['dst', 'dst_addr'],
             ['sb', 'dst_sb_addr', -1],
             ['ain', 'dst_ain_addr', -1]],
            [['len_limit', 1],
             ['dst_stride', 1],
             ['dst_clear', True],
             ['src_addr', -1],
             ['src_stride', 1]]],
    'clr_v': [TranOp, ['op_code', TranOpCode.CLR], NanoOpTypes.TopsName, None,
            [['pid', 'dst_peer_id'],
             ['dst', 'dst_addr'],
             ['sb', 'dst_sb_addr', -1],
             ['ain', 'dst_ain_addr', -1],
             ['dst_stride', 'dst_stride', 1],
             ['count', 'len_limit']],
            [['dst_clear', True],
             ['src_addr', -1],
             ['src_stride', 1]]],
}